﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLBH.DataModel;
using QLBH.ConfigLib;
using System.Data.Objects;

namespace QLBH.Model.Controller
{
    public class QLBHEntityBase<T>:GenericRepository<QLBHEntities,T> where T:class
    {
          public QLBHEntityBase()
              :base()
          {
              Context = QLBHEntitiesInstance.Instance;              
          }       
    }
    public class QLBHEntitiesInstance
    {  
        private static QLBHEntities instance;

        public static QLBHEntities Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new QLBHEntities(EntityDBConnectionHelper.Instance.GetEntityConnection());                    
                } 
              
                return QLBHEntitiesInstance.instance;
            }

        }
        public static void ReCreateInstance()
        {
            instance = new QLBHEntities(EntityDBConnectionHelper.Instance.GetEntityConnection());
        }
    }
}
